import { compareTime } from '@/util/util';
export default function (config) {
  return {
    data() {
      var checkStartTime = (rule, value, callback) => {
        let formOrderType = 'form' + this.addDialog.headerForm.type;
        if (!this.addDialog[formOrderType].planStartTime) {
          callback(new Error('请输入计划开始时间'));
        }
        if (!this.addDialog[formOrderType].planEndTime) {
          callback();
        } else if (this.addDialog[formOrderType].planEndTime && value) {
          let result = compareTime(this.addDialog[formOrderType].planEndTime, value);
          if (result === 2) {
            callback(new Error('计划开始时间不能大于计划完成时间'));
          } else {
            callback();
          }
        } else {
          callback();
        }
      };
      var checkEndTime = (rule, value, callback) => {
        let formOrderType = 'form' + this.addDialog.headerForm.type;
        if (!this.addDialog[formOrderType].planEndTime) {
          callback(new Error('请输入计划完成时间'));
        }
        if (!this.addDialog[formOrderType].planStartTime) {
          callback();
        } else if (this.addDialog[formOrderType].planStartTime && value) {
          let result = compareTime(this.addDialog[formOrderType].planStartTime, value);
          if (result === 1) {
            callback(new Error('计划完成时间不能小于计划开始时间'));
          } else {
            callback();
          }
        } else {
          callback();
        }
      };
      var extFieldsValidate = (rule, value, callback) => {
        if (value) {
          if (typeof value == 'string') {
            try {
              let obj = JSON.parse(value);
              if (typeof obj == 'object') {
                callback();
              } else {
                callback(new Error('请输入正确的JSON格式'));
              }
            } catch (e) {
              callback(new Error('请输入正确的JSON格式'));
            }
          }
        } else {
          callback();
        }
      };
      return {
        addDialog: {
          option1: {
            submitBtn: false,
            emptyBtn: false,
            labelWidth: 125,
            column: [
              {
                label: '生产订单',
                prop: 'productionOrderNo',
                searchType: 'input',
                type: 'search',
                disabled: true,
                appendClick: () => {
                  this.openUserCommonModal({
                    type: 'productionOrderNo'
                  });
                }
              },
              {
                label: '销售订单',
                prop: 'salesOrderNo',
                disabled: true
              },
              {
                label: '客户名称',
                prop: 'customerName',
                disabled: true,
                searchType: 'input',
                type: 'search',
                appendClick: () => {
                  this.openUserCommonModal({
                    type: 'partnerName'
                  });
                }
              },
              {
                label: '产品编码',
                prop: 'productPartNo',
                searchType: 'input',
                type: 'search',
                dicData: [],
                disabled: true,
                placeholder: '请选择 产品编码',
                rules: [
                  {
                    required: true,
                    message: '请输入产品编码',
                    trigger: 'blur'
                  }
                ],
                appendClick: () => {
                  this.openUserCommonModal({ type: 'productCode' });
                }
              },
              {
                label: '产品名称',
                prop: 'productPartName',
                disabled: true
              },
              {
                label: '产品型号',
                prop: 'productPartModel',
                disabled: true
              },
              {
                label: '生产批次',
                prop: 'lotNo'
              },
              {
                label: '工单计划数量',
                prop: 'planQuantity',
                type: 'number',
                minRows: 1,
                rules: [
                  {
                    required: true,
                    message: '请输入工单计划数量',
                    trigger: 'blur'
                  }
                ]
              },
              {
                label: '计划投入数',
                prop: 'inputQuantity',
                type: 'number'
              },

              {
                label: '计划开始时间',
                prop: 'planStartTime',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm:ss',
                valueFormat: 'yyyy-MM-dd HH:mm:ss',
                pickerOptions: {
                  disabledDate: (time) => {
                    if (!this.addDialog.form1.planEndTime) {
                      return time.getTime() < new Date(1970 - 1 - 1).getTime() || time.getTime() < Date.now() - 3600 * 1000 * 24; //禁止选择1970年以前的日期
                    } else {
                      return time.getTime() > new Date(this.addDialog.form1.planEndTime) || time.getTime() < Date.now() - 3600 * 1000 * 24;
                    }
                  }
                },
                rules: [
                  {
                    required: true,
                    validator: checkStartTime,
                    trigger: 'change'
                  }
                ]
              },
              {
                label: '计划完成时间',
                prop: 'planEndTime',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm:ss',
                valueFormat: 'yyyy-MM-dd HH:mm:ss',
                pickerOptions: {
                  disabledDate: (time) => {
                    return (
                      time.getTime() < new Date(this.addDialog.form1.planStartTime) - 3600 * 1000 * 24 || time.getTime() < new Date(1970 - 1 - 1).getTime() //禁止选择1970年以前的日期
                    );
                  }
                },
                rules: [
                  {
                    required: true,
                    validator: checkEndTime,
                    trigger: 'change'
                  }
                ]
              },
              {
                label: '备注',
                prop: 'remark',
                type: 'textarea',
                span: 24,
                maxRows: 3,
                minRows: 3,
                maxlength: 300,
                overHidden: true,
                showWordLimit: true
              },
              {
                label: '扩展属性',
                prop: 'extFields',
                type: 'textarea',
                labelTip: '其他系统中工单的个性化参数化信息（MES中并未维护），以json格式同步至此处，可用于工单列表显示等。',
                span: 24,
                maxRows: 3,
                minRows: 3,
                maxlength: 300,
                showWordLimit: true,
                rules: [
                  {
                    required: false,
                    validator: extFieldsValidate,
                    trigger: 'blur'
                  }
                ]
              }
            ]
          },
          option2: {
            submitBtn: false,
            emptyBtn: false,
            labelWidth: 125,
            column: [
              {
                label: '生产订单',
                prop: 'productionOrderNo',
                searchType: 'input',
                type: 'search',
                disabled: true,
                appendClick: () => {
                  this.openUserCommonModal({
                    type: 'productionOrderNo'
                  });
                }
              },
              {
                label: '销售订单',
                prop: 'salesOrderNo',
                disabled: true
              },
              {
                label: '客户名称',
                prop: 'customerName',
                disabled: true,
                searchType: 'input',
                type: 'search',
                appendClick: () => {
                  this.openUserCommonModal({
                    type: 'partnerName'
                  });
                }
              },
              {
                label: '产品编码',
                prop: 'productPartNo',
                searchType: 'input',
                type: 'search',
                dicData: [],
                disabled: true,
                placeholder: '请选择 产品编码',
                rules: [
                  {
                    required: true,
                    message: '请输入产品编码',
                    trigger: 'blur'
                  }
                ],
                appendClick: () => {
                  this.openUserCommonModal({ type: 'productCode' });
                }
              },
              {
                label: '产品名称',
                prop: 'productPartName',
                disabled: true
              },
              {
                label: '产品型号',
                prop: 'productPartModel',
                disabled: true
              },
              {
                label: '生产批次',
                prop: 'lotNo'
              },
              {
                label: '工单计划数量',
                prop: 'planQuantity',
                type: 'number',
                minRows: 1,
                rules: [
                  {
                    required: true,
                    message: '请输入工单计划数量',
                    trigger: 'blur'
                  }
                ]
              },
              {
                label: '计划投入数',
                prop: 'inputQuantity',
                type: 'number'
              },
              {
                label: '计划开始时间',
                prop: 'planStartTime',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm:ss',
                valueFormat: 'yyyy-MM-dd HH:mm:ss',
                pickerOptions: {
                  disabledDate: (time) => {
                    if (!this.addDialog.form1.planEndTime) {
                      return time.getTime() < new Date(1970 - 1 - 1).getTime() || time.getTime() < Date.now() - 3600 * 1000 * 24; //禁止选择1970年以前的日期
                    } else {
                      return time.getTime() > new Date(this.addDialog.form1.planEndTime) || time.getTime() < Date.now() - 3600 * 1000 * 24;
                    }
                  }
                },
                rules: [
                  {
                    required: true,
                    validator: checkStartTime,
                    trigger: 'change'
                  }
                ]
              },
              {
                label: '计划完成时间',
                prop: 'planEndTime',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm:ss',
                valueFormat: 'yyyy-MM-dd HH:mm:ss',
                pickerOptions: {
                  disabledDate: (time) => {
                    return (
                      time.getTime() < new Date(this.addDialog.form1.planStartTime) - 3600 * 1000 * 24 || time.getTime() < new Date(1970 - 1 - 1).getTime() //禁止选择1970年以前的日期
                    );
                  }
                },
                rules: [
                  {
                    required: true,
                    validator: checkEndTime,
                    trigger: 'change'
                  }
                ]
              },
              {
                label: '备注',
                prop: 'remark',
                type: 'textarea',
                span: 24,
                maxRows: 3,
                minRows: 3,
                maxlength: 300,
                overHidden: true,
                showWordLimit: true
              },
              {
                label: '扩展属性',
                prop: 'extFields',
                type: 'textarea',
                labelTip: '其他系统中工单的个性化参数化信息（MES中并未维护），以json格式同步至此处，可用于工单列表显示等。',
                span: 24,
                maxRows: 3,
                minRows: 3,
                maxlength: 300,
                showWordLimit: true,
                rules: [
                  {
                    required: false,
                    validator: extFieldsValidate,
                    trigger: 'blur'
                  }
                ]
              }
            ]
          },
          option3: {
            submitBtn: false,
            emptyBtn: false,
            labelWidth: 125,
            column: [
              {
                label: '生产订单',
                prop: 'productionOrderNo',
                searchType: 'input',
                type: 'search',
                disabled: true,
                appendClick: () => {
                  this.openUserCommonModal({
                    type: 'productionOrderNo'
                  });
                }
              },
              {
                label: '销售订单',
                prop: 'salesOrderNo',
                disabled: true
              },
              {
                label: '客户名称',
                prop: 'customerName',
                disabled: true,
                searchType: 'input',
                type: 'search',
                appendClick: () => {
                  this.openUserCommonModal({
                    type: 'partnerName'
                  });
                }
              },
              {
                label: '产品编码',
                prop: 'productPartNo',
                searchType: 'input',
                type: 'search',
                dicData: [],
                disabled: true,
                placeholder: '请选择 产品编码',
                rules: [
                  {
                    required: true,
                    message: '请输入产品编码',
                    trigger: 'blur'
                  }
                ],
                appendClick: () => {
                  this.openUserCommonModal({ type: 'productCode' });
                }
              },
              {
                label: '产品名称',
                prop: 'productPartName',
                disabled: true
              },
              {
                label: '产品型号',
                prop: 'productPartModel',
                disabled: true
              },
              {
                label: '生产批次',
                prop: 'lotNo'
              },
              {
                label: '工单计划数量',
                prop: 'planQuantity',
                type: 'number',
                minRows: 1,
                rules: [
                  {
                    required: true,
                    message: '请输入工单计划数量',
                    trigger: 'blur'
                  }
                ]
              },
              {
                label: '计划投入数',
                prop: 'inputQuantity',
                type: 'number'
              },
              {
                label: '计划开始时间',
                prop: 'planStartTime',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm:ss',
                valueFormat: 'yyyy-MM-dd HH:mm:ss',
                pickerOptions: {
                  disabledDate: (time) => {
                    if (!this.addDialog.form1.planEndTime) {
                      return time.getTime() < new Date(1970 - 1 - 1).getTime() || time.getTime() < Date.now() - 3600 * 1000 * 24; //禁止选择1970年以前的日期
                    } else {
                      return time.getTime() > new Date(this.addDialog.form1.planEndTime) || time.getTime() < Date.now() - 3600 * 1000 * 24;
                    }
                  }
                },
                rules: [
                  {
                    required: true,
                    validator: checkStartTime,
                    trigger: 'change'
                  }
                ]
              },
              {
                label: '计划完成时间',
                prop: 'planEndTime',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm:ss',
                valueFormat: 'yyyy-MM-dd HH:mm:ss',
                pickerOptions: {
                  disabledDate: (time) => {
                    return (
                      time.getTime() < new Date(this.addDialog.form1.planStartTime) - 3600 * 1000 * 24 || time.getTime() < new Date(1970 - 1 - 1).getTime() //禁止选择1970年以前的日期
                    );
                  }
                },
                rules: [
                  {
                    required: true,
                    validator: checkEndTime,
                    trigger: 'change'
                  }
                ]
              },
              {
                label: '备注',
                prop: 'remark',
                type: 'textarea',
                span: 24,
                maxRows: 3,
                minRows: 3,
                maxlength: 300,
                overHidden: true,
                showWordLimit: true
              },
              {
                label: '扩展属性',
                prop: 'extFields',
                type: 'textarea',
                labelTip: '其他系统中工单的个性化参数化信息（MES中并未维护），以json格式同步至此处，可用于工单列表显示等。',
                span: 24,
                maxRows: 3,
                minRows: 3,
                maxlength: 300,
                showWordLimit: true,
                rules: [
                  {
                    required: false,
                    validator: extFieldsValidate,
                    trigger: 'blur'
                  }
                ]
              }
            ]
          },
          option4: {
            submitBtn: false,
            emptyBtn: false,
            labelWidth: 125,
            column: [
              {
                label: '生产订单',
                prop: 'productionOrderNo',
                searchType: 'input',
                type: 'search',
                disabled: true,
                appendClick: () => {
                  this.openUserCommonModal({
                    type: 'productionOrderNo'
                  });
                }
              },
              {
                label: '销售订单',
                prop: 'salesOrderNo',
                disabled: true
              },
              {
                label: '客户名称',
                prop: 'customerName',
                disabled: true,
                searchType: 'input',
                type: 'search',
                appendClick: () => {
                  this.openUserCommonModal({
                    type: 'partnerName'
                  });
                }
              },
              {
                label: '产品编码',
                prop: 'productPartNo',
                searchType: 'input',
                type: 'search',
                dicData: [],
                disabled: true,
                placeholder: '请选择 产品编码',
                rules: [
                  {
                    required: true,
                    message: '请输入产品编码',
                    trigger: 'blur'
                  }
                ],
                appendClick: () => {
                  this.openUserCommonModal({ type: 'productCode' });
                }
              },
              {
                label: '产品名称',
                prop: 'productPartName',
                disabled: true
              },
              {
                label: '产品型号',
                prop: 'productPartModel',
                disabled: true
              },
              {
                label: '生产批次',
                prop: 'lotNo'
              },
              {
                label: '工单计划数量',
                prop: 'planQuantity',
                type: 'number',
                minRows: 1,
                rules: [
                  {
                    required: true,
                    message: '请输入工单计划数量',
                    trigger: 'blur'
                  }
                ]
              },
              {
                label: '计划投入数',
                prop: 'inputQuantity',
                type: 'number'
              },
              {
                label: '计划开始时间',
                prop: 'planStartTime',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm:ss',
                valueFormat: 'yyyy-MM-dd HH:mm:ss',
                pickerOptions: {
                  disabledDate: (time) => {
                    if (!this.addDialog.form1.planEndTime) {
                      return time.getTime() < new Date(1970 - 1 - 1).getTime() || time.getTime() < Date.now() - 3600 * 1000 * 24; //禁止选择1970年以前的日期
                    } else {
                      return time.getTime() > new Date(this.addDialog.form1.planEndTime) || time.getTime() < Date.now() - 3600 * 1000 * 24;
                    }
                  }
                },
                rules: [
                  {
                    required: true,
                    validator: checkStartTime,
                    trigger: 'change'
                  }
                ]
              },
              {
                label: '计划完成时间',
                prop: 'planEndTime',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm:ss',
                valueFormat: 'yyyy-MM-dd HH:mm:ss',
                pickerOptions: {
                  disabledDate: (time) => {
                    return (
                      time.getTime() < new Date(this.addDialog.form1.planStartTime) - 3600 * 1000 * 24 || time.getTime() < new Date(1970 - 1 - 1).getTime() //禁止选择1970年以前的日期
                    );
                  }
                },
                rules: [
                  {
                    required: true,
                    validator: checkEndTime,
                    trigger: 'change'
                  }
                ]
              },
              {
                label: '备注',
                prop: 'remark',
                type: 'textarea',
                span: 24,
                maxRows: 3,
                minRows: 3,
                maxlength: 300,
                overHidden: true,
                showWordLimit: true
              },
              {
                label: '扩展属性',
                prop: 'extFields',
                type: 'textarea',
                labelTip: '其他系统中工单的个性化参数化信息（MES中并未维护），以json格式同步至此处，可用于工单列表显示等。',
                span: 24,
                maxRows: 3,
                minRows: 3,
                maxlength: 300,
                showWordLimit: true,
                rules: [
                  {
                    required: false,
                    validator: extFieldsValidate,
                    trigger: 'blur'
                  }
                ]
              }
            ]
          },
          option5: {
            submitBtn: false,
            emptyBtn: false,
            labelWidth: 125,
            column: [
              {
                label: '生产订单',
                prop: 'productionOrderNo',
                searchType: 'input',
                type: 'search',
                disabled: true,
                appendClick: () => {
                  this.openUserCommonModal({
                    type: 'productionOrderNo'
                  });
                }
              },
              {
                label: '销售订单',
                prop: 'salesOrderNo',
                disabled: true
              },
              {
                label: '客户名称',
                prop: 'customerName',
                disabled: true,
                searchType: 'input',
                type: 'search',
                appendClick: () => {
                  this.openUserCommonModal({
                    type: 'partnerName'
                  });
                }
              },
              {
                label: '产品编码',
                prop: 'productPartNo',
                searchType: 'input',
                type: 'search',
                dicData: [],
                disabled: true,
                placeholder: '请选择 产品编码',
                rules: [
                  {
                    required: true,
                    message: '请输入产品编码',
                    trigger: 'blur'
                  }
                ],
                appendClick: () => {
                  this.openUserCommonModal({ type: 'productCode' });
                }
              },
              {
                label: '产品名称',
                prop: 'productPartName',
                disabled: true
              },
              {
                label: '产品型号',
                prop: 'productPartModel',
                disabled: true
              },
              {
                label: '生产批次',
                prop: 'lotNo'
              },
              {
                label: '工单计划数量',
                prop: 'planQuantity',
                type: 'number',
                minRows: 1,
                rules: [
                  {
                    required: true,
                    message: '请输入工单计划数量',
                    trigger: 'blur'
                  }
                ]
              },
              {
                label: '计划投入数',
                prop: 'inputQuantity',
                type: 'number'
              },
              {
                label: '计划开始时间',
                prop: 'planStartTime',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm:ss',
                valueFormat: 'yyyy-MM-dd HH:mm:ss',
                pickerOptions: {
                  disabledDate: (time) => {
                    if (!this.addDialog.form1.planEndTime) {
                      return time.getTime() < new Date(1970 - 1 - 1).getTime() || time.getTime() < Date.now() - 3600 * 1000 * 24; //禁止选择1970年以前的日期
                    } else {
                      return time.getTime() > new Date(this.addDialog.form1.planEndTime) || time.getTime() < Date.now() - 3600 * 1000 * 24;
                    }
                  }
                },
                rules: [
                  {
                    required: true,
                    validator: checkStartTime,
                    trigger: 'change'
                  }
                ]
              },
              {
                label: '计划完成时间',
                prop: 'planEndTime',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm:ss',
                valueFormat: 'yyyy-MM-dd HH:mm:ss',
                pickerOptions: {
                  disabledDate: (time) => {
                    return (
                      time.getTime() < new Date(this.addDialog.form1.planStartTime) - 3600 * 1000 * 24 || time.getTime() < new Date(1970 - 1 - 1).getTime() //禁止选择1970年以前的日期
                    );
                  }
                },
                rules: [
                  {
                    required: true,
                    validator: checkEndTime,
                    trigger: 'change'
                  }
                ]
              },

              {
                label: '备注',
                prop: 'remark',
                type: 'textarea',
                span: 24,
                maxRows: 3,
                minRows: 3,
                maxlength: 300,
                overHidden: true,
                showWordLimit: true
              },
              {
                label: '扩展属性',
                prop: 'extFields',
                type: 'textarea',
                labelTip: '其他系统中工单的个性化参数化信息（MES中并未维护），以json格式同步至此处，可用于工单列表显示等。',
                span: 24,
                maxRows: 3,
                minRows: 3,
                maxlength: 300,
                showWordLimit: true,
                rules: [
                  {
                    required: false,
                    validator: extFieldsValidate,
                    trigger: 'blur'
                  }
                ]
              }
            ]
          },
          option6: {
            submitBtn: false,
            emptyBtn: false,
            labelWidth: 125,
            column: [
              {
                label: '原始工单',
                prop: 'originalWorkOrderNo',
                type: 'search',
                disabled: true,
                rules: [
                  {
                    required: true,
                    message: '请输入原始工单',
                    trigger: 'blur'
                  }
                ],
                appendClick: () => {
                  this.openUserCommonModal({
                    type: 'originalWorkOrderNo'
                  });
                }
              },
              {
                label: '原生产订单',
                prop: 'productionOrderNo',
                disabled: true
              },
              {
                label: '原销售订单',
                prop: 'salesOrderNo',
                disabled: true
              },
              {
                label: '客户名称',
                prop: 'customerName',
                disabled: true,
                searchType: 'input',
                type: 'search',
                searchOrder: 8,
                appendClick: () => {
                  this.openUserCommonModal({
                    type: 'partnerName'
                  });
                }
              },
              {
                label: '原产品编码',
                prop: 'originalProductPartNo',
                searchType: 'input',
                hide: true,
                dicData: [],
                disabled: true,
                appendClick: () => {
                  this.openUserCommonModal({ type: 'productCode' });
                }
              },
              {
                label: '原产品名称',
                prop: 'originalProductPartName',
                disabled: true
              },
              {
                label: '原产品型号',
                prop: 'originalProductPartModel',
                disabled: true
              },
              {
                label: '产品总数',
                prop: 'originalPlanQuantity',
                disabled: true
              },
              {
                label: '生产批次',
                prop: 'lotNo',
                disabled: true
              },
              {
                label: '返工工单号',
                prop: 'workOrderNo',
                formslot: true,
                labelTip: '若未填入，则保存工单信息后自动生成工单号。'
              },
              {
                label: '改制后产品编码',
                prop: 'productPartNo',
                searchType: 'input',
                type: 'search',
                dicData: [],
                disabled: true,
                appendClick: () => {
                  this.openUserCommonModal({ type: 'oldAfterpartNo' });
                },
                rules: [
                  {
                    required: true,
                    message: '请选择改制后产品编码',
                    trigger: 'blur'
                  }
                ]
              },
              {
                label: '改制返工数',
                prop: 'planQuantity',
                type: 'number',
                rules: [
                  {
                    required: true,
                    message: '请输入改制返工数',
                    trigger: 'blur'
                  }
                ]
              },
              {
                label: '计划开始时间',
                prop: 'planStartTime',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm:ss',
                valueFormat: 'yyyy-MM-dd HH:mm:ss',
                pickerOptions: {
                  disabledDate: (time) => {
                    if (!this.addDialog.form6.planEndTime) {
                      return time.getTime() < new Date(1970 - 1 - 1).getTime() || time.getTime() < Date.now() - 3600 * 1000 * 24; //禁止选择1970年以前的日期
                    } else {
                      return time.getTime() > new Date(this.addDialog.form6.planEndTime) || time.getTime() < Date.now() - 3600 * 1000 * 24;
                    }
                  }
                },
                rules: [
                  {
                    required: true,
                    validator: checkStartTime,
                    trigger: 'change'
                  }
                ]
              },
              {
                label: '计划完成时间',
                prop: 'planEndTime',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm:ss',
                valueFormat: 'yyyy-MM-dd HH:mm:ss',
                pickerOptions: {
                  disabledDate: (time) => {
                    return (
                      time.getTime() < new Date(this.addDialog.form6.planStartTime) - 3600 * 1000 * 24 || time.getTime() < new Date(1970 - 1 - 1).getTime() //禁止选择1970年以前的日期
                    );
                  }
                },
                rules: [
                  {
                    required: true,
                    validator: checkEndTime,
                    trigger: 'change'
                  }
                ]
              },
              {
                label: '改制说明',
                prop: 'reworkDescription',
                type: 'textarea',
                span: 24,
                maxRows: 3,
                minRows: 3,
                maxlength: 300,
                overHidden: true,
                showWordLimit: true,
                rules: [
                  {
                    required: true,
                    message: '请输入改制说明',
                    trigger: 'blur'
                  }
                ]
              }
            ]
          },
          option7: {
            submitBtn: false,
            emptyBtn: false,
            labelWidth: 125,
            column: [
              {
                label: '生产订单',
                prop: 'productionOrderNo',
                searchType: 'input',
                type: 'search',
                disabled: true,
                appendClick: () => {
                  this.openUserCommonModal({
                    type: 'productionOrderNo'
                  });
                }
              },
              {
                label: '销售订单',
                prop: 'salesOrderNo',
                disabled: true
              },
              {
                label: '客户名称',
                prop: 'customerName',
                disabled: true,
                searchType: 'input',
                type: 'search',
                appendClick: () => {
                  this.openUserCommonModal({
                    type: 'partnerName'
                  });
                }
              },
              {
                label: '产品编码',
                prop: 'productPartNo',
                searchType: 'input',
                type: 'search',
                dicData: [],
                disabled: true,
                placeholder: '请选择 产品编码',
                rules: [
                  {
                    required: true,
                    message: '请输入产品编码',
                    trigger: 'blur'
                  }
                ],
                appendClick: () => {
                  this.openUserCommonModal({ type: 'productCode' });
                }
              },
              {
                label: '产品名称',
                prop: 'productPartName',
                disabled: true
              },
              {
                label: '产品型号',
                prop: 'productPartModel',
                disabled: true
              },
              {
                label: '生产批次',
                prop: 'lotNo'
              },
              {
                label: '工单计划数量',
                prop: 'planQuantity',
                type: 'number',
                minRows: 1,
                rules: [
                  {
                    required: true,
                    message: '请输入工单计划数量',
                    trigger: 'blur'
                  }
                ]
              },
              {
                label: '计划投入数',
                prop: 'inputQuantity',
                type: 'number'
              },
              {
                label: '计划开始时间',
                prop: 'planStartTime',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm:ss',
                valueFormat: 'yyyy-MM-dd HH:mm:ss',
                pickerOptions: {
                  disabledDate: (time) => {
                    if (!this.addDialog.form1.planEndTime) {
                      return time.getTime() < new Date(1970 - 1 - 1).getTime() || time.getTime() < Date.now() - 3600 * 1000 * 24; //禁止选择1970年以前的日期
                    } else {
                      return time.getTime() > new Date(this.addDialog.form1.planEndTime) || time.getTime() < Date.now() - 3600 * 1000 * 24;
                    }
                  }
                },
                rules: [
                  {
                    required: true,
                    validator: checkStartTime,
                    trigger: 'change'
                  }
                ]
              },
              {
                label: '计划完成时间',
                prop: 'planEndTime',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm:ss',
                valueFormat: 'yyyy-MM-dd HH:mm:ss',
                pickerOptions: {
                  disabledDate: (time) => {
                    return (
                      time.getTime() < new Date(this.addDialog.form1.planStartTime) - 3600 * 1000 * 24 || time.getTime() < new Date(1970 - 1 - 1).getTime() //禁止选择1970年以前的日期
                    );
                  }
                },
                rules: [
                  {
                    required: true,
                    validator: checkEndTime,
                    trigger: 'change'
                  }
                ]
              },

              {
                label: '备注',
                prop: 'remark',
                type: 'textarea',
                span: 24,
                maxRows: 3,
                minRows: 3,
                maxlength: 300,
                overHidden: true,
                showWordLimit: true
              },
              {
                label: '扩展属性',
                prop: 'extFields',
                type: 'textarea',
                labelTip: '其他系统中工单的个性化参数化信息（MES中并未维护），以json格式同步至此处，可用于工单列表显示等。',
                span: 24,
                maxRows: 3,
                minRows: 3,
                maxlength: 300,
                showWordLimit: true,
                rules: [
                  {
                    required: false,
                    validator: extFieldsValidate,
                    trigger: 'blur'
                  }
                ]
              }
            ]
          },
          option8: {
            submitBtn: false,
            emptyBtn: false,
            labelWidth: 125,
            column: [
              {
                label: '生产订单',
                prop: 'productionOrderNo',
                searchType: 'input',
                type: 'search',
                disabled: true,
                appendClick: () => {
                  this.openUserCommonModal({
                    type: 'productionOrderNo'
                  });
                }
              },
              {
                label: '销售订单',
                prop: 'salesOrderNo',
                disabled: true
              },
              {
                label: '客户名称',
                prop: 'customerName',
                disabled: true,
                searchType: 'input',
                type: 'search',
                appendClick: () => {
                  this.openUserCommonModal({
                    type: 'partnerName'
                  });
                }
              },
              {
                label: '产品编码',
                prop: 'productPartNo',
                searchType: 'input',
                type: 'search',
                dicData: [],
                disabled: true,
                placeholder: '请选择 产品编码',
                rules: [
                  {
                    required: true,
                    message: '请输入产品编码',
                    trigger: 'blur'
                  }
                ],
                appendClick: () => {
                  this.openUserCommonModal({ type: 'productCode' });
                }
              },
              {
                label: '产品名称',
                prop: 'productPartName',
                disabled: true
              },
              {
                label: '产品型号',
                prop: 'productPartModel',
                disabled: true
              },
              {
                label: '生产批次',
                prop: 'lotNo'
              },
              {
                label: '工单计划数量',
                prop: 'planQuantity',
                type: 'number',
                minRows: 1,
                rules: [
                  {
                    required: true,
                    message: '请输入工单计划数量',
                    trigger: 'blur'
                  }
                ]
              },
              {
                label: '计划投入数',
                prop: 'inputQuantity',
                type: 'number'
              },
              {
                label: '计划开始时间',
                prop: 'planStartTime',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm:ss',
                valueFormat: 'yyyy-MM-dd HH:mm:ss',
                pickerOptions: {
                  disabledDate: (time) => {
                    if (!this.addDialog.form1.planEndTime) {
                      return time.getTime() < new Date(1970 - 1 - 1).getTime() || time.getTime() < Date.now() - 3600 * 1000 * 24; //禁止选择1970年以前的日期
                    } else {
                      return time.getTime() > new Date(this.addDialog.form1.planEndTime) || time.getTime() < Date.now() - 3600 * 1000 * 24;
                    }
                  }
                },
                rules: [
                  {
                    required: true,
                    validator: checkStartTime,
                    trigger: 'change'
                  }
                ]
              },
              {
                label: '计划完成时间',
                prop: 'planEndTime',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm:ss',
                valueFormat: 'yyyy-MM-dd HH:mm:ss',
                pickerOptions: {
                  disabledDate: (time) => {
                    return (
                      time.getTime() < new Date(this.addDialog.form1.planStartTime) - 3600 * 1000 * 24 || time.getTime() < new Date(1970 - 1 - 1).getTime() //禁止选择1970年以前的日期
                    );
                  }
                },
                rules: [
                  {
                    required: true,
                    validator: checkEndTime,
                    trigger: 'change'
                  }
                ]
              },

              {
                label: '备注',
                prop: 'remark',
                type: 'textarea',
                span: 24,
                maxRows: 3,
                minRows: 3,
                maxlength: 300,
                overHidden: true,
                showWordLimit: true
              },
              {
                label: '扩展属性',
                prop: 'extFields',
                type: 'textarea',
                labelTip: '其他系统中工单的个性化参数化信息（MES中并未维护），以json格式同步至此处，可用于工单列表显示等。',
                span: 24,
                maxRows: 3,
                minRows: 3,
                maxlength: 300,
                showWordLimit: true,
                rules: [
                  {
                    required: false,
                    validator: extFieldsValidate,
                    trigger: 'blur'
                  }
                ]
              }
            ]
          },
          option9: {
            submitBtn: false,
            emptyBtn: false,
            labelWidth: 125,
            column: [
              {
                label: '原始工单',
                prop: 'originalWorkOrderNo',
                type: 'search',
                disabled: true,
                rules: [
                  {
                    required: true,
                    message: '请输入原始工单',
                    trigger: 'blur'
                  }
                ],
                appendClick: () => {
                  this.openUserCommonModal({
                    type: 'originalWorkOrderNo'
                  });
                }
              },
              {
                label: '原生产订单',
                prop: 'productionOrderNo',
                disabled: true
              },
              {
                label: '原销售订单',
                prop: 'salesOrderNo',
                disabled: true
              },
              {
                label: '客户名称',
                prop: 'customerName',
                disabled: true,
                searchType: 'input',
                type: 'search',
                appendClick: () => {
                  this.openUserCommonModal({
                    type: 'partnerName'
                  });
                }
              },
              {
                label: '产品编码',
                prop: 'productPartNo',
                disabled: true,
                placeholder: '请选择 产品编码',
                rules: [
                  {
                    required: true,
                    message: '请输入产品编码',
                    trigger: 'blur'
                  }
                ],
                appendClick: () => {
                  this.openUserCommonModal({ type: 'productCode' });
                }
              },
              {
                label: '产品名称',
                prop: 'productPartName',
                disabled: true,
                rules: [
                  {
                    required: true,
                    message: '请输入产品名称',
                    trigger: 'blur'
                  }
                ]
              },
              {
                label: '产品型号',
                prop: 'productPartModel',
                disabled: true
              },
              {
                label: '产品总数',
                prop: 'originalPlanQuantity',
                disabled: true
              },
              {
                label: '生产批次',
                prop: 'lotNo',
                disabled: true
              },
              {
                label: '返工工单号',
                prop: 'workOrderNo',
                formslot: true,
                labelTip: '若未填入，则保存工单信息后自动生成工单号。'
              },
              {
                label: '不良返工数',
                prop: 'planQuantity',
                type: 'number',
                rules: [
                  {
                    required: true,
                    message: '请输入不良返工数',
                    trigger: 'blur'
                  }
                ]
              },
              {
                label: '计划开始时间',
                prop: 'planStartTime',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm:ss',
                valueFormat: 'yyyy-MM-dd HH:mm:ss',
                pickerOptions: {
                  disabledDate: (time) => {
                    if (!this.addDialog.form9.planEndTime) {
                      return time.getTime() < new Date(1970 - 1 - 1).getTime() || time.getTime() < Date.now() - 3600 * 1000 * 24; //禁止选择1970年以前的日期
                    } else {
                      return time.getTime() > new Date(this.addDialog.form9.planEndTime) || time.getTime() < Date.now() - 3600 * 1000 * 24;
                    }
                  }
                },
                rules: [
                  {
                    required: true,
                    validator: checkStartTime,
                    trigger: 'change'
                  }
                ]
              },
              {
                label: '计划完成时间',
                prop: 'planEndTime',
                type: 'datetime',
                format: 'yyyy-MM-dd HH:mm:ss',
                valueFormat: 'yyyy-MM-dd HH:mm:ss',
                pickerOptions: {
                  disabledDate: (time) => {
                    return (
                      time.getTime() < new Date(this.addDialog.form9.planStartTime) - 3600 * 1000 * 24 || time.getTime() < new Date(1970 - 1 - 1).getTime() //禁止选择1970年以前的日期
                    );
                  }
                },
                rules: [
                  {
                    required: true,
                    validator: checkEndTime,
                    trigger: 'change'
                  }
                ]
              },
              {
                label: '不良说明',
                prop: 'reworkDescription',
                type: 'textarea',
                span: 24,
                maxRows: 3,
                minRows: 3,
                maxlength: 300,
                overHidden: true,
                showWordLimit: true
              }
            ]
          }
        },
        option: {
          column: [
            {
              label: '工单类型',
              prop: 'type',
              type: 'select',
              searchOrder: 6,
              search: true,
              value: '1',
              dicUrl: '/api/blade-system/dict/dictionary?code=order_type',
              props: {
                label: 'dictValue',
                value: 'dictKey'
              }
            },
            {
              label: '工单号',
              prop: 'workOrderNo',
              searchOrder: 1,
              width: 150,
              overHidden: true,
              search: true
            },
            {
              label: '生产订单',
              prop: 'productionOrderNo',
              search: true,
              width: 120,
              searchOrder: 2,
              searchType: 'input',
              overHidden: true,
              type: 'search'
            },
            {
              label: '产品编码',
              prop: 'productPartNo',
              search: true,
              searchOrder: 3,
              searchType: 'input',
              type: 'search',
              overHidden: true,
              dicData: []
            },
            {
              label: '产品名称',
              prop: 'productPartName',
              search: true,
              overHidden: true,
              searchOrder: 4
            },
            {
              label: '产品型号',
              overHidden: true,
              prop: 'productPartModel',
              searchOrder: 5
            },
            {
              label: 'BOM版本',
              prop: 'bomVersion',
              width: 100
            },
            {
              label: '工单计划数量',
              prop: 'planQuantity',
              width: 100
            },
            {
              label: '计划开始时间',
              prop: 'planStartTime',
              type: 'datetime',
              width: 130,
              format: 'yyyy-MM-dd HH:mm:ss',
              valueFormat: 'yyyy-MM-dd HH:mm:ss',
              pickerOptions: {
                disabledDate: (time) => {
                  if (!this.form.planEndTime) {
                    return time.getTime() < new Date(1970 - 1 - 1).getTime() || time.getTime() < Date.now() - 3600 * 1000 * 24; //禁止选择1970年以前的日期
                  } else {
                    return time.getTime() > new Date(this.form.planEndTime) || time.getTime() < Date.now() - 3600 * 1000 * 24;
                  }
                }
              }
            },
            {
              label: '计划完成时间',
              prop: 'planEndTime',
              type: 'datetime',
              width: 130,
              format: 'yyyy-MM-dd HH:mm:ss',
              valueFormat: 'yyyy-MM-dd HH:mm:ss',
              pickerOptions: {
                disabledDate: (time) => {
                  return (
                    time.getTime() < new Date(this.form.planStartTime) - 3600 * 1000 * 24 || time.getTime() < new Date(1970 - 1 - 1).getTime() //禁止选择1970年以前的日期
                  );
                }
              }
            },
            {
              label: '工单状态',
              prop: 'status',
              searchOrder: 7,
              type: 'select',
              search: true,
              width: 80,
              addDisplay: false,
              editDisplay: false,
              html: true,
              formatter: (val) => this.$statusText.GD(val.status),
              props: {
                label: 'dictValue',
                value: 'dictKey'
              },
              dicUrl: '/api/blade-system/dict/dictionary?code=mfg_work_order'
            },
            {
              label: '工单状态',
              prop: 'statusDesc',
              type: 'select',
              width: 80,
              hide: true
            },
            {
              label: '生产批次',
              prop: 'lotNo',
              searchOrder: 11,
              search: true
            },
            {
              label: '客户名称',
              prop: 'customerName',
              search: true,
              searchType: 'input',
              type: 'search',
              searchOrder: 9
            },
            {
              label: '销售订单',
              prop: 'salesOrderNo'
            },
            {
              label: '计划完成日期',
              prop: 'datetimerange',
              type: 'date',
              searchLabelWidth: 100,
              searchOrder: 8,
              search: true,
              searchType: 'date',
              format: 'yyyy-MM-dd',
              valueFormat: 'yyyy-MM-dd',
              hide: true
            },
            {
              label: '备注',
              prop: 'remark',
              type: 'textarea',
              // search: true,
              searchOrder: 12,
              width: 60,
              span: 24,
              maxRows: 3,
              minRows: 3,
              maxlength: 300,
              overHidden: true,
              showWordLimit: true
            }
          ]
        }
      };
    }
  };
}
